package controllers.administrator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import controllers.AbstractController;

import services.AuctionService;

@Controller
@RequestMapping("/auction/admin")
public class AuctionAdministratorController extends AbstractController {
	
	// Supporting services ----------------------------------------------------
	
	@Autowired
	private AuctionService auctionService;

	// Constructors -----------------------------------------------------------
	
	public AuctionAdministratorController() {
		super();
	}
		
	// Listing ---------------------------------------------------------------		

	@RequestMapping("/list")
	public ModelAndView list() {
		ModelAndView result;
				
		result = new ModelAndView("auction/list");
		
		result.addObject("auctions", auctionService.findPastAuctions());
		result.addObject("URI", "/auction/admin/list.do");
		
		return result;
	}
	
}